package users;
/**
 * Abstract class that holds the generic requirements for any user.
 * 
 * @author Matt Minch
 * 
 * revised by: Taylor Zielske
 */
import java.io.Serializable;
import java.util.UUID;

public abstract class User implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private UUID my_ID;
	private String my_Name;
	
	/**
	 * Creates a User object
	 * 
	 * @param user the name of the user.
	 * @param emailAddress the Email Address of the User.
	 */
	public User(String user) {
		my_Name = user;
		my_ID = java.util.UUID.randomUUID();
	}
	
	/**
	 * Gets the users name.
	 * 
	 * @return myName, the name of the user.
	 */
	public String getName(){
		return my_Name;
	}
	
	
	/**
	 * Gets a users user ID.
	 * 
	 * @return myID, a users unique ID.
	 */
	public UUID getID(){
		return my_ID;
	}
	
	public void setName(String name)
	{
		my_Name = name;
	}
	public String toString() {
		return my_Name;
	}
	
	/** @return the role of this user */
	public String getRole() {
		if (this instanceof Author) {
			return "Author";
		} else if (this instanceof ProgramChair) {
			return "Program Chair";
		} else if (this instanceof Reviewer) {
			return "Reviewer";
		} else {
			throw new IllegalStateException();
		}
	}
	
}
